{
  // const findFirstFn = (arr) => arr[0];
  // const result1 = findFirstFn([1]); //  期望返回类型为number
  // const result2 = findFirstFn(['1']); // 期望返回类型为string
  type FindFirstFn = <T>(arr: T[]) => T;
  const findFn: FindFirstFn = (arr) => {
    return arr[0];
  };

  // const findNameFn = (obj) => obj.name;
  // findNameFn({name: '123'})  返回值类型string
  // findNameFn({name: 123})  返回值类型number
  type FindNameFn = <T>(obj: { name: T }) => T;
  const findNameFn = (obj) => obj.name;
  let str = findNameFn({ name: '123' });
  str.startsWith('123');
  let num = findNameFn({ name: 456 });
  num.toFixed(2);
}
